/*
	This file is part of PropExtractor.

	AliceDecrypt is free software: you can redistribute it and/or modify
	it under the terms of the GNU General Public License as published by
	the Free Software Foundation, either version 3 of the License, or
	(at your option) any later version.

	AliceDecrypt is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
	GNU General Public License for more details.

	You should have received a copy of the GNU General Public License
	along with PropExtractor. If not, see <http://www.gnu.org/licenses/>.
*/

#include "PEFile.h"

namespace pe
{

	// ================================
	// Files
	// ================================

	int PEFileOpen(PEFile* a_Target, const char* a_FilePath, const char* a_Options)
	{
		a_Target->handle = fopen(a_FilePath, "rb");
		if (!a_Target->handle) { return -1; }

		a_Target->path = new char[strlen(a_FilePath) + 1];
		strcpy(a_Target->path, a_FilePath);

		return 0;
	}

	int PEFileClose(PEFile* a_File)
	{
		fclose(a_File->handle);
		delete a_File;

		return 0;
	}

};